<!-- 轮播图区域 -->
<template>
    <swiper>
        <swiper-item v-for="(item,index) in banners" :key="index">
            <a :href="item.link">
                <img :src="item.image" alt="" @load="imgLoad">
            </a>
        </swiper-item>
    </swiper>
</template>

<script>
    import {Swiper,SwiperItem} from 'components/common/swiper/index'
    export default {
        name:'HomeSwiper',
        props:{
            banners:{
                type:Array,
                default(){
                    return [];
                }
            }
        },
        data(){
            return {
                isload:false
            }
        },
        components:{
            Swiper,
            SwiperItem
        },
        methods: {
            imgLoad(){
                //这里图片加载完成会执行4此，然后我们只需要发射一次事件
                if(!this.isload){
                    this.$emit('swiperImgLoad');
                    this.isload = true;
                }
            }
        }
    }
</script>

<style scoped>
</style>